import { Column, Entity } from "typeorm";
import { BaseEntity } from "../../base/entity/base";

export enum RelatedType {
    PRODUCT = 'PRODUCT',
    ORDER = 'ORDER',
    PROVIDER = 'PROVIDER',
    TEAM = 'TEAM',
    CAR = 'CAR',
    SCHEDULE = 'SCHEDULE',
    INVITE = 'INVITE',
}

@Entity('comment_info', { comment: '评论信息' })
export class CommentInfoEntity extends BaseEntity {

    @Column({ type: 'text', comment: '评论内容' })
    content: string;

    @Column({ type: 'simple-array', comment: '评论图片' })
    images: string[];

    @Column({ type: 'json', comment: '多维度评分列表' })
    scoreList: {
        label: string; // 服务态度、专业能力、响应速度、解决问题能力、其他
        score: number;
    }[];

    @Column({ type: 'decimal', precision: 10, scale: 1, comment: '平均评分' })
    averageScore: number;

    @Column({ comment: '关联用户ID' })
    userId: number;

    @Column({ comment: '关联ID' })
    relatedId: number;

    @Column({ type: 'enum', enum: RelatedType, comment: '关联类型' })
    relatedType: RelatedType;

}